/* 
 * File:   harvestspritetest.cpp
 * Author: dolphinigle
 *
 * Created on March 15, 2011, 6:03 PM
 */

#include <stdlib.h>
#include "gtest/gtest.h"
#include "direction.hpp"
#include "player.hpp"
#include "harvestsprite.hpp"
#include "game.hpp"
#include "plantablecell.hpp"
#include "plant.hpp"
#include "plantconstants.hpp"

TEST(HarvestSpriteTest, All) {

  Game* game = new Game("Irvan", "test.gag");
  
  HarvestSprite s(game);

  PlantableCell* pc = (PlantableCell*) game->getMaps()->getField()->getCellAt(2,2);

  EXPECT_FALSE(s.isImportant(pc));

  Plant* p = new Plant(game, pc, 0);
  game->getCreatures()->getPlants()->addPlant(p);

  EXPECT_FALSE(s.isImportant(pc));

  pc->water();

  for (int i = 0; i < PlantConstants::getPlantMatureTime(0) +
          PlantConstants::getPlantRipeTime(0, 0); ++i) {
    EXPECT_FALSE(s.isImportant(pc));
    p->advanceDay();
  }

  EXPECT_TRUE(s.isImportant(pc));

  EXPECT_EQ(s.getType(), kHarvest);

  delete game;

}


